Hearing devices that perform digital signal processing of digital audio signals received from another device are known in the art. Such hearing devices may be designed so that the processing rate, i.e. the rate with which the signal processing requires input samples, equals the input rate, i.e. the rate with which audio signal samples are received. However, various factors, such as production tolerances, variations in the clock frequencies of the transmitting and receiving devices and errors in the transmission, may cause the input rate to at least temporarily deviate from the processing rate. At the same time it is often desired to keep the processing rate constant over time. In such cases, the input signal is preferably pre-processed to ensure that the signal processing receives the required samples at the processing rate.
A known and rather simple solution is to provide the hearing device with an input buffer into which the received samples are written on arrival and from which the respective oldest unread sample is read by the signal processing when it requires a new sample. When a buffer under-run occurs, i.e. when the buffer is empty when a read operation is due, then the last sample read is repeated as input to the signal processing. When a buffer over-run occurs, i.e. when the buffer is full when a write operation is due, then the sample to be written is discarded (skipped). This simple form of sample-rate conversion, in the following referred to as skip-and-repeat, has the disadvantage that the skipping and repeating of samples causes clearly audible artefacts in the processed signal. It is further only successfully applicable when the input rate and the processing rate are close to each other.
It is further known to upsample the input signal to provide samples at a resampling rate which is an integer multiple—defined as the upsampling factor—of the input rate. The skip-and-repeat procedure is performed on the upsampled signal, and thus at the resampling rate, to provide a sample rate equalling an integer multiple of the processing rate. The resulting signal is subsequently downsampled to the processing rate by an integer downsampling factor. This upsampled skip-and-repeat method also causes artefacts in the processed signal, but they are less audible than those caused by the simple skip- and repeat method described above. Furthermore, by selecting different up- and downsampling factors this method may be used to perform sample-rate conversion when the input rate and the processing rate are not close to each other.
In the present context, the conversion ratio is defined as the ratio of the processing rate to the input rate. The range of conversion-ratio variations with which a device has to cope may differ between different systems and scenarios. If the range of variations is large and/or if variations occur fast, then a more sophisticated control of the skipping and repeating in the upsampled skip-and-repeat method is required to avoid that multiple skip operations or multiple repeat operations occur immediately after each other, which could otherwise significantly reduce the quality of the processed signal. The upsampled skip-and-repeat method is more sensitive to such variations than the simple method because in the upsampled method a single missing input sample may cause several consecutive repetitions of an upsampled signal sample. Where the input signal is received in packets each comprising multiple signal samples, the content of entire packets may be lost due to transmission errors. The loss of packets, and the well known and widely implemented retransmission of lost packets to avoid gaps in the processed audio signal, both worsen these problems.
In the above mentioned skip-and-repeat methods, multiple skip operations or multiple repeat operations occurring immediately after each other are mainly caused by the fact that the decision to increase or decrease the conversion ratio is taken on the basis of information regarding a single sample and that the decision is immediately carried out, namely by skipping or repeating the respective sample. Therefore, alternative methods have been developed in the art, which provide a slower working control of the conversion ratio.
One such known alternative method comprises performing sample-rate conversion with a piecewise constant conversion ratio, e.g. by upsampling and downsampling as described above, however without skipping and repeating upsampled samples. The received input samples are buffered, and the conversion ratio is increased when the buffer level, i.e. the number of buffered samples, sinks below a predetermined lower threshold, and conversely decreased when the buffer level grows above a predetermined upper threshold. The thresholds are preferably selected so that their difference is smaller than the total buffer size and they thus provide room both below the lower threshold and above the upper threshold. This extra room is used to allow for overshoot of the control algorithm. The buffer size, the buffer thresholds and the step sizes with which the conversion ratio is respectively increased and decreased are chosen such that they together allow the method to adapt to expected variations in the input rate without risking actual buffer under-runs or over-runs. The method also works when one of the upsampling and the downsampling factor equals unity.
Signal processing generally requires resources, such as logic circuits, memory space, computation time or power, each of which is typically a limited resource in hearing devices—and even more so in battery-powered hearing devices. It is therefore desirable to implement sample-rate conversion in hearing devices using methods that are particularly efficient. In most sample-rate conversion methods, and particular in such methods comprising upsampling and subsequent downsampling of the resampled signal, filtering is required to avoid aliasing artefacts in the processed signal. This filtering adds significantly to the complexity and the resource consumption of the sample-rate conversion, and the design of the filters is therefore of high importance in hearing devices. Upsampling followed by—or integral with—filtering to remove aliased frequencies is in the art generally referred to as interpolation. In the following, the term upsampling should be interpreted to cover both upsampling without such filtering and interpolation.
An efficient known method for sample-rate conversion comprises the use of so-called polyphase filters in the upsampling and in the downsampling steps. Each received input sample is fed in parallel to a set of digital filters, which each represents a specific phase of an interpolation filter to be applied. The outputs of the phase filters in the set are cyclically sampled at the resampling rate, one cycle for each input sample, and the thus resampled samples are cyclically fed to individual digital filters in a second set. Each filter in the second set represents a specific phase of a downsampling filter to be applied, and the outputs of these phase filters are added at the processing rate, thus providing a sample-rate-converted signal at the processing rate. The interpolation filter is typically configured to suppress frequencies above half the input rate, and the downsampling filter is typically configured to suppress frequencies above half the processing rate. The interpolation filter and the downsampling filter thus suppress aliasing artefacts in the processed signal. The sum of the lengths of the phase filters in a set is equal to or slightly larger than the length of the respective interpolation or downsampling filter.
In [1], chapter 10.5.3, “Time-Variant Filter Structures”, the authors disclose how sample-rate conversion using polyphase filters may be implemented in a particularly efficient manner. In the disclosed method, the interpolation filter and the downsampling filter are combined in a single filter configured such that it suppresses frequencies above half the minimum of the input rate and the processing rate. The method allows the computation of the sample-rate converted signal to be performed basically by buffering the received input samples and at the processing rate computing a scalar product of a subset of the buffered samples and a subset of filter coefficients of the filter. The actual subsets to be used are selected dynamically from respectively the input buffer and a set of filter coefficients, using respective indices that are dynamically updated for each output sample to be computed.
The above described methods based on polyphase filters, may obviously be used in combination with the above described method wherein a piecewise constant conversion ratio is changed when the buffer level exceeds predetermined buffer thresholds. The conversion ratio may be changed by changing the upsampling factor and/or the downsampling factor. Since, however, the lengths and the coefficients of the phase filters depend on the up- and downsampling factors, the lengths and the coefficients of the phase filters must either be recomputed or be read from a repository of pre-stored filter configurations each time the conversion ratio changes. This obviously requires computation time and/or storage space in addition to the resources required for the conversion itself.
Furthermore, changing the conversion ratio based on predetermined buffer thresholds as described above causes the latency, i.e. the time delay from an input sample is received until the corresponding output sample is delivered to the signal processing, to vary with time and, at least to some extent, unpredictably. Also, in the known methods and devices, the buffer thresholds are chosen in advance and such that adaptation is possible when the input rate variations are within a range expected at the time of implementing the method or manufacturing the device. If the variations are larger than expected, the sample-rate conversion may not function properly, and if the variations are smaller than expected, the latency will be longer than needed. However, in hearing devices a consistent and short latency is often important, particularly when a hearing-device user is able to see the source of the sound he or she is listening to, e.g. when the user listens to the sound of a video or a TV broadcast.
Also, in hearing devices wherein retransmission of lost packets is implemented, the size of the input buffer and the value of the lower buffer threshold are typically selected to allow for a predetermined number of consecutive retransmissions of the same lost packet before a buffer under-run occurs. This, however, causes the latency to be larger than needed during time periods without retransmission.